diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2024-01-29 22:37:13 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2024-01-30 12:57:21 -0500 |
| commit | 9e300e0ff0c9d93cbaeaa86c1e2a560523107382 (patch) | |
| tree | ebeaea60117fbac781a415e3299395f3f8e637d7 /src/app/groups/[groupId]/layout.tsx | |
| parent | 3847a67a192a04098643e19953549a99ca152b8a (diff) | |
Use React’s cache to avoid some queries to the database
Diffstat (limited to 'src/app/groups/[groupId]/layout.tsx')
| -rw-r--r-- | src/app/groups/[groupId]/layout.tsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/app/groups/[groupId]/layout.tsx b/src/app/groups/[groupId]/layout.tsx index fc76b61..cb31df7 100644 --- a/src/app/groups/[groupId]/layout.tsx +++ b/src/app/groups/[groupId]/layout.tsx @@ -1,7 +1,7 @@ +import { cached } from '@/app/cached-functions' import { GroupTabs } from '@/app/groups/[groupId]/group-tabs' import { SaveGroupLocally } from '@/app/groups/[groupId]/save-recent-group' import { ShareButton } from '@/app/groups/[groupId]/share-button' -import { getGroup } from '@/lib/api' import { Metadata } from 'next' import Link from 'next/link' import { notFound } from 'next/navigation' @@ -16,7 +16,7 @@ type Props = { export async function generateMetadata({ params: { groupId }, }: Props): Promise<Metadata> { - const group = await getGroup(groupId) + const group = await cached.getGroup(groupId) return { title: { @@ -30,7 +30,7 @@ export default async function GroupLayout({ children, params: { groupId }, }: PropsWithChildren<Props>) { - const group = await getGroup(groupId) + const group = await cached.getGroup(groupId) if (!group) notFound() return ( |
